package ConditionPackage;

import be.kuleuven.cs.som.annotate.Raw;
import SquarePackage.Square;
import SquarePackage.TeleportableSquare;
/**
 * invar= always needs a Square to search for
 * @author Florian
 * @version 1.0
 *
 */
public class TeleportationCondition implements Condition {
	/**
	 * constructor that gives you the oppurtunity to Set a square we want the startPoints for 
	 * @param destination the teleport Destination we want to retrieve in destination sets.
	 */
	public TeleportationCondition(TeleportableSquare destination){
		setDestination(destination);
	}
	/**
	 * DANGER: empty constructor needs a setDestination Before use or NULLPointerException
	 */
	@Raw
	public TeleportationCondition(){
		
	}
	/**
	 * checker
	 * @return True if and only if object.canteleportTo(destination)
	 */
	@Override
	public boolean checkCondition(Square object) {
		if(object instanceof TeleportableSquare){
			if(((TeleportableSquare) object).canTeleportTo(destination)  )
				return true;
		}
		return false;
	}
	private TeleportableSquare destination;
	/**
	 * setter for the destination
	 * @param destination
	 */
	public void setDestination(TeleportableSquare destination) {
		this.destination = destination;
	}
	

}
